import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',  //首页
    name: 'home',
    component: HomeView
  },
  {
    path: '/special',  //专题
    name: 'special',
    component: () => import(/* webpackChunkName: "special" */ '../views/SpecialView.vue')
  },
  {
    path: '/category', //分类
    name: 'category',
    component: () => import(/* webpackChunkName: "category" */ '../views/CategorylView.vue')
  },
  {
    path: '/cart',
    name: 'cart',
    component: () => import(/* webpackChunkName: "cart" */ '../views/CartView.vue')
  },
  {
    path: '/user',
    name: 'user',
    component: () => import(/* webpackChunkName: "User" */ '../views/UserView.vue')
  },
  {
    path: '/productsDetail',
    name: 'ProductsDetail',
    component: () => import('../views/ProductsDetail.vue')
  }
]

const router = new VueRouter({
  mode: "hash", // 如果是hash,带#, 如果是history,就没有#
  base: process.env.BASE_URL,
  routes
})

export default router
